import { createPersistedState } from 'pinia-plugin-persistedstate'

export const persistedState = createPersistedState({
  storage: {
    getItem: (key: string) => uni.getStorageSync(key),
    setItem: (key: string, value: string) => uni.setStorageSync(key, value),
    // 👇 使用类型断言来绕过 ts 报错
    removeItem: (key: string) => uni.removeStorageSync(key),
  } as unknown as Storage,
})